package top.csy8888.likework.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import top.csy8888.likework.common.vo.ResultVO;
import top.csy8888.likework.dto.LikeDTO;
import top.csy8888.likework.entity.Like;
import top.csy8888.likework.service.LikeService;

/**
 * @author CSY
 * @date 2025 - 10 - 13
 */
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class LikeController {
    private final LikeService likeService;

    @GetMapping("/like/{userId}/{postId}")
    public ResultVO<LikeDTO> like(@PathVariable("userId") Integer userId, @PathVariable("postId") Integer postId){
        LikeDTO likeDTO = likeService.like(userId, postId);
        return ResultVO.success(likeDTO);
    }
}
